﻿<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ITO职业能力实训工程室平台</title>
    <link  href="${ctx}/static/css/index.css" rel="stylesheet" type="text/css" /> 
    <link  href="${ctx}/static/ligerui/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" /> 
   
    <script src="${ctx}/static/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>    
    <script src="${ctx}/static/ligerui/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script> 
    
    <link href="${ctx}/static/ligerui/lib/css/common.css" rel="stylesheet" type="text/css" />  
    <link href="${ctx}/static/ligerui/lib/css/index.css" rel="stylesheet" type="text/css" />
    
    <link href="${ctx}/static/css/teacher/css/main.css" rel="stylesheet" type="text/css" />
    
    <script src="${ctx}/static/ligerui/lib/js/LG.js" type="text/javascript"></script>
    <script src="${ctx}/static/ligerui/lib/js/login.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/main.js" type="text/javascript"></script>
    <script src="${ctx}/static/js/common.js" type="text/javascript"></script>
    
    <script src="${ctx}/static/js/comet/comet.js" type="text/javascript"></script>
    
      
</head>
<body style="text-align:center; background:url('${ctx}/static/ligerui/lib/images/qso/bg-1477x768.jpg'); overflow:hidden;">
    <div id="pageloading" style="display:block;"></div> 
    <div id="topmenu" class="l-topmenu">
        <div class="l-topmenu-logo"><img src="${ctx}/static/ligerui/lib/images/qso/header-logo.png" /></div>
        <div class="l-topmenu-welcome"> 
            <span class="l-topmenu-username"></span>欢迎您, <shiro:principal/> !&nbsp;
            <a href="${ctx }/logout" style="background:url('${ctx}/static/icons/main/logout.png') no-repeat scroll 0px -2px transparent;padding-left:24px;">退出</a>
            <c:if test="${userType eq 'tea' }">          
            <a href="javascript:toTeach()" style="background:url('${ctx}/static/css/teacher/img/header-nav-icon.png') no-repeat scroll -18px -28px transparent;padding-left:22px;">课程教学</a>
            <a href="javascript:toMonitor()" style="background:url('${ctx}/static/css/teacher/img/header-nav-icon.png') no-repeat scroll -32px -3px transparent;padding-left:24px;">画面监控</a>
        	<a href="javascript:toInstruct()" style="background:url('${ctx}/static/css/teacher/img/header-nav-icon.png') no-repeat scroll 0px -52px transparent;padding-left:22px;">指导</a>
            <img src="${ctx}/static/icons/main/question.png" alt="" id="questionTip" style="margin-bottom:-3px;"/>
            </c:if>
        </div>
        
    </div> 
     <div id="mainbody" class="l-mainbody" style="width:99.2%; margin:0 auto; margin-top:3px;" >
        <div position="left" title="主要菜单" id="mainmenu"></div>  
        <div position="center" id="framecenter"> 
            <div tabid="home" title="我的主页"> 
                <iframe frameborder="0" name="home" id="home" src="${ctx }/welcome"></iframe>
            </div> 
        </div> 
    </div>
    <div class="l-hidden"></div>
    <script type="text/javascript">
    window.name="main";
    //teacher.js
    	var dialog;
    	var teaVmWin=null;
    	
	    function toTeach(){
	    	dialog=$.ligerDialog.open({url: '${ctx}/qso/teach/toTeach',height:380, width:650, showMax: true, showToggle: true, showMin: true, isResize: true, modal: true, allowClose:true,isHidden:false,title:"登陆虚拟机"});
	    }
	    
	    function closeVmDialog(){
	    	dialog.close();
	    }
	    
	    
	    function toMonitor(){
	    	window.open('${ctx}/qso/monitor/toMonitor','monitorWin');
	    	//dialog=$.ligerDialog.open({url: '${ctx}/qso/monitor/toMonitor',height:650, width:800, showMax: true, showToggle: true, showMin: true, isResize: true, modal: true, title:"监控"});
	    }
	    
	    function toInstruct(){
	    	
	    	dialog=$.ligerDialog.open({url: '${ctx}/qso/instruct/toInstructMain',name:"instructList",height:550,width:930,showMax:true,showToggle:true,showMin:true,isResize:false,isDrag:false,modal:true,allowClose:true,isHidden:false,title:"问题列表"});
	    }
	    
	    
	    function saveAsync(){
	    	$("#cometFrame").attr("src","${ctx }/qso/comet/saveAsync?r="+Math.random());
	    }
	    
		
	    function checkQuestion(){
	    	LG.ajax({
	    		url:"${ctx}/qso/helpque/checkWaitQuestion",
	    		success:function(result){
	    			if(result.success){
	    				if(result.data>0){
	    					$("#questionTip").attr("src","${ctx}/static/icons/main/question.gif");
	    				}else{
	    					$("#questionTip").attr("src","${ctx}/static/icons/main/question.png");
	    				}
	    			}
	    		}
	    	});
	    }
	    

		
		addLoadEvent(saveAsync);
		addLoadEvent(checkQuestion);
    </script>
    <script type="text/javascript">

        //tabid计数器，保证tabid不会重复
        var tabidcounter = 0;
        //窗口改变时的处理函数
        function f_heightChanged(options) {
            if (tab)
                tab.addHeight(options.diff);
            if (accordion && options.middleHeight - 24 > 0)
                accordion.setHeight(options.middleHeight - 24);
        }
        //增加tab项的函数
        function f_addTab(tabid, text, url) {
            if (!tab) return;
            if (!tabid)
            {
                tabidcounter++;
                tabid = "tabid" + tabidcounter; 
            }
            tab.addTabItem({ tabid: tabid, text: text, url: url });
        }
        //修改密码
        function f_changepassword()
        {
            LG.changepassword();
        }
        $(document).ready(function ()
        {

            //菜单初始化
            $("ul.menulist li").live('click', function ()
            {
                var jitem = $(this);
                var tabid = jitem.attr("menuno");
                var url = jitem.attr("url");
                if (!url) return;
                if (!tabid)
                {
                    tabidcounter++;
                    tabid = "tabid" + tabidcounter;
                    jitem.attr("tabid", tabid);
                    jitem.attr("url", url);
                }
                f_addTab(tabid, $("span:first", jitem).html(), url);
            }).live('mouseover', function ()
            {
                var jitem = $(this);
                jitem.addClass("over");
            }).live('mouseout', function ()
            {
                var jitem = $(this);
                jitem.removeClass("over");
            });

            //布局初始化 
            //layout
            layout = $("#mainbody").ligerLayout({ height: '100%', heightDiff: -3, leftWidth: 140, onHeightChanged: f_heightChanged, minLeftWidth: 120 });
            var bodyHeight = $(".l-layout-center:first").height();
            //Tab
            tab = $("#framecenter").ligerTab({ height: bodyHeight, contextmenu: true });


            //预加载dialog的背景图片
            LG.prevDialogImage('${ctx}');

            var mainmenu = $("#mainmenu");

            $.getJSON('${ctx}/myMenus?rnd='+Math.random(), function (menus)
            {
            	var menuJsons=toAccordion(menus);
                $(menuJsons).each(function (i, menu)
                {
                    var item = $('<div title="' + menu.name + '"><ul class="menulist"></ul></div>');
                    item.attr({
                        img: '${ctx}/static/'+menu.muIcon
                    });
                    $(menu.children).each(function (j, submenu)
                    {
                        var subitem = $('<li><span></span><div class="menuitem-l"></div><div class="menuitem-r"></div></li>');
                        subitem.attr({
                            url: submenu.muHref,
                            menuno: submenu.muRel
                        });
                        $("span", subitem).html(submenu.name);

                        $("ul:first", item).append(subitem);
                    });
                    mainmenu.append(item);

                });

                //Accordion
                accordion = $("#mainmenu").ligerAccordion({ height: bodyHeight - 24, speed: null });



                $("#pageloading").hide();
            });

/**
 *             
 LG.ajax({
     type: 'AjaxMemberManage',
     method: 'GetCurrentUser',
     success: function (user)
     {
         $(".l-topmenu-username").html(user.Title + "，");
     },
     error: function ()
     {
         LG.tip('用户信息加载失败');
     }
 });
 */
        });
    </script>
    <iframe id="cometFrame" style="display: none;"></iframe>
</body>
</html>